import request from "./request"

//角色
const getRoles=()=>request.get('roles')

//修改
 const updataRole = (id, rid) => request.put(`users/${id}/role`, { rid })

 //获取角色数据
const getMenusList=()=>request.get(`roles`)

//获取提交角色

const addRolesList=(model)=>request.post(`roles`,model)

//删除角色

const deletList=(model)=>request.delete(`roles/${model.id}`)

//修改角色
const editList=(model)=>request.put(`roles/${model.id}`,model)


//权限列表
const RightsList=()=>request.get('rights/list')


//删除标签
const deleteTag=(roleId,rightsId)=>request.delete(`roles/${roleId}/rights/${rightsId}`)


//获取菜单
const getMenusTree=()=>request.get('/rights/tree')

const assignRights=(id,rids)=>request.post(`roles/${id}/rights`,{rids})
export{
    assignRights,
    getMenusTree,
    getRoles,
    updataRole,
    getMenusList,
    addRolesList,
    deletList,editList,RightsList,deleteTag
}